#!/bin/sh

LOG="logger -t lo"

start() {
 $LOG "Start loopback interface..."
    eval `nvram_buf_get 2860 IPv6_Enable`

    ip link set lo up
    ip addr flush dev lo
    if [ -d /proc/sys/net/ipv6 ] && [ "$IPv6_Enable" = "1" ]; then
	ip -6  addr flush dev lo
    fi
    ip addr add 127.0.0.1/8 dev lo
    if [ -d /proc/sys/net/ipv6 ] && [ "$IPv6_Enable" = "1" ]; then
	ip -6 addr add ::1/128 dev lo
    fi
    ip route replace 127.0.0.0/8 dev lo
    ip route replace 127.0.0.0/8 dev lo table default
}

stop() {
    :
}

case "$1" in
	start)
	    start
	    ;;

	stop)
	    stop
	    ;;

	restart)
	    stop
	    start
	    ;;

	*)
	    echo $"Usage: $0 {start|stop|restart}"
	    exit 1
esac
